import { get, post } from '@/utils/request'

const prefix = 'setting'

export default {
  /**
   * 店铺货运设置信息
   */
  freight: () => {
    return get(`${prefix}/freight/index`)
  },
  /**
   * 店铺货运设置信息
   */
  freightLogicstics: () => {
    return get(`${prefix}/freight/logicstics`)
  },
  /**
   * 店铺货运设置信息
   */
  freightAdjustLogicstics: id => {
    return post(`${prefix}/freight/express`, {
      express_id: id
    })
  },
  /**
   * 更新对接部门
   */
  updateDepartment: (data, id, postMethod = true) => {
    if (postMethod) {
      return post(`${prefix}/department/update?id=${id}`, data)
    } else {
      return get(`${prefix}/department/update?id=${id}`)
    }
  },
  /**
   * 更新对接部门
   */
  updateStage: (data, id, postMethod = true) => {
    if (postMethod) {
      return post(`${prefix}/stage/update?id=${id}`, data)
    } else {
      return get(`${prefix}/stage/update?id=${id}`)
    }
  },
  /**
   * 更新对接部门
   */
  updateAgreement: (data, id, postMethod = true) => {
    if (postMethod) {
      return post(`${prefix}/agreement/update?id=${id}`, data)
    } else {
      return get(`${prefix}/agreement/update?id=${id}`)
    }
  },
  /**
   * 更新对接部门
   */
  updateRule: (data, id, postMethod = true) => {
    if (postMethod) {
      return post(`${prefix}/rule/update?id=${id}`, data)
    } else {
      return get(`${prefix}/rule/update?id=${id}`)
    }
  }
}
